package com.food.user.util;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;

public class DateUtils {
    public static String parseString(LocalDateTime time,String patten){
        return DateUtil.format(time,patten);
    }
    public static Long parseLong(String time,String patten) throws Exception{
        SimpleDateFormat sdf = new SimpleDateFormat(patten);
        return sdf.parse(time).getTime();
    }

      public static DateTime parseStringToDateTime(String time) throws Exception {
          Long aLong = DateUtils.parseLong(time, "yyyy-MM-dd'T'hh:mm:ss.SSS'Z'");
          DateTime of = DateTime.of(aLong+(8*60*60*1000));
          return of;
      }
}
